﻿// -------------------------------------------------------------------------
//    @FileName         :    LoginAction.cpp
//    @Author           :    gaoyi
//    @Date             :    24-8-7
//    @Email            :    445267987@qq.com
//    @Module           :    LoginAction
//
// -------------------------------------------------------------------------

#include "LoginAction.h"
#include "GameApi.h"
#include <NFComm/NFPluginModule/NFCheck.h>

int LoginReqAction::MakePacket()
{
	CHECK_NULL(0, m_pGameAPI);

	proto_ff::Proto_CSReq       oCSReq;
	proto_ff::Proto_CSLoginReq& oLoginReq = *(oCSReq.mutable_login());
	oLoginReq.set_player_uin(m_pGameAPI->GetUid());
	oLoginReq.set_account_id(m_pGameAPI->GetOpenID());
	oLoginReq.set_account_pwd("hdwj606");
	oLoginReq.set_account_type(proto_ff::E_VISITOR);
	oLoginReq.set_user_sex(proto_ff::E_FEMALE);
	oLoginReq.set_user_head_url("123", 3);
	proto_ff::Proto_LoginClientInfo* accountinfo = oLoginReq.mutable_client_info();
	accountinfo->set_client_version("10.10.10.10");
	accountinfo->set_plat_type(proto_ff::E_PLAT_ANDROID);
	accountinfo->set_network_type(proto_ff::E_NETWORK_WIFI);
	accountinfo->set_uuid(m_pGameAPI->GetOpenID());
	accountinfo->set_reg_channel(0);

	int iRet = m_pGameAPI->Send(proto_ff::E_CS_LOGIN_REQ, oCSReq, m_pGameAPI->GetSendSeq());
	CHECK_RET(iRet, "Send(proto_ff::E_CS_LOGIN_REQ, oCSReq) Failed");
	return iRet;
}

int LoginReqAction::HandleCSPacket(int iCmd, proto_ff::Proto_CSRsp& oCSRsp, bool& bIsEnd)
{
	return IAction::HandleCSPacket(iCmd, oCSRsp, bIsEnd);
}

int CreateRoleAction::MakePacket()
{
	return 0;
}

int CreateRoleAction::HandleCSPacket(int iCmd, proto_ff::Proto_CSRsp& oCSRsp, bool& bIsEnd)
{
	return IAction::HandleCSPacket(iCmd, oCSRsp, bIsEnd);
}

int GetRoleAction::MakePacket()
{
	return 0;
}

int GetRoleAction::HandleCSPacket(int iCmd, proto_ff::Proto_CSRsp& oCSRsp, bool& bIsEnd)
{
	return IAction::HandleCSPacket(iCmd, oCSRsp, bIsEnd);
}

int HeartBeatAction::MakePacket()
{
	return 0;
}

int HeartBeatAction::HandleCSPacket(int iCmd, proto_ff::Proto_CSRsp& oCSRsp, bool& bIsEnd)
{
	return IAction::HandleCSPacket(iCmd, oCSRsp, bIsEnd);
}

int MapQueryAction::MakePacket()
{
	return 0;
}

int MapQueryAction::HandleCSPacket(int iCmd, proto_ff::Proto_CSRsp& oCSRsp, bool& bIsEnd)
{
	return IAction::HandleCSPacket(iCmd, oCSRsp, bIsEnd);
}
